from logic import adminDao
from model import model
import datetime


#初始化
nav = model.navlist()
nav.level=1
nav.name="日常"
nav.type=1
nav.save()

for a in range(1,30):
    article = model.article()
    article.tid=nav.id
    article.author="admin"
    article.content="欢迎使用coreCms"+str(a)
    article.title="这是一个测试文章"+str(a)
    article.updateDate = datetime.datetime.now()
    article.save()


navart = model.navlist()
navart.level=3
navart.name="友情连接"
navart.type=3
navart.url="https://baidu.com"
navart.save()

about = model.navlist()
about.level = 2
about.name = "about"
about.type = 2
about.title="关于本站"
about.content="关于我阿   哈哈哈哈哈哈阿和"
about.updateDate=datetime.datetime.now()
about.save()


print("输入用户")
user = input()
print("输入密码")
passwd=input()

status = adminDao.adminDao().createAdmin(user,passwd)
if status:
    print("创建成功")
else:
    print("失败")

